<!DOCTYPE html >
<html >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1, user-scalable=no">
<title>elem</title>
	<script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
<link href="/admin/css/bootstrap.min.css" title="" rel="stylesheet" />
<link title="orange" href="/admin/css/login.css" rel="stylesheet" type="text/css"/>
<link rel="icon" href="/favicon.ico">
</head>

<body>
<div style="height:1px;"></div>
<div class="login">
 <header>
    <h1>欢迎登陆</h1>
 </header>
 <div class="sr">
	    <div class="name">
			<label>
			<i class="sublist-icon glyphicon glyphicon-user"></i>
			</label>
			<input type="text" name="appId" id="appId"  placeholder="这里输入登录名" class="name_inp">
		</div>
		 <div class="name">
			<label>
			<i class="sublist-icon glyphicon glyphicon-pencil"></i>
			</label>
			<input type="text" name="appSceart" id="appSceart"  placeholder="这里输入登录密码" class="name_inp">
		</div>
		<button type="button" onclick="login()" class="dl">立即登陆</button>
 </div>
</div>
</body>
</html>
<script>
    function login() {
        var appId = $("#appId").val();
        var appSceart = $("#appSceart").val();
        if (appId == "" || appSceart == "") {
            layer.msg('用户名或密码不能为空', {icon: 2});
            return;
        }
        $.ajax({
            type: "POST",
            url: "/api/admin/login",
            data: {
                "appId": appId,
                "appSceart": appSceart
            },
            success: function (e) {
                alert(e.msg)
				if(e.code=='200'){
                    window.location.href='/api/admin/index'
				}
            },
            error: function (e) {
                alert(e.msg)
            }
        });
    }
</script>
